// import { ROLE_ROUTES } from './constants/permissions';
import {
  CarOutlined,
  ToolOutlined,
  SafetyOutlined,
  DatabaseOutlined,
  CarryOutOutlined,
  UserOutlined,
  MobileOutlined,
  ShoppingOutlined,
  TeamOutlined,
  MailOutlined,
  CalendarOutlined,
  SettingOutlined,
  AppstoreOutlined,
  LinkOutlined
} from '@ant-design/icons';
const routes = [
  {
    name: "404",
    path: '/NotFound',
    component: 'pages/NotFound/index',
    hideInMenu: true,
  },
  {
    name: "登录",
    path: '/login',
    component: 'pages/Login',
    hideInMenu: true,
  },
  {
    name: "工作台",
    path: '/Workbenches',
    component: 'pages/Workbenches/index',
    icon:<AppstoreOutlined />
  },
  {
    name: "用户管理",
    path: '/users',
    // component: 'pages/Users',
    // roles: ['admin'],
    icon:<TeamOutlined />,
    routes: [
      {
        name: "用户列表",
        path: '/users/list',
        component: 'pages/Users/list',
        icon:<UserOutlined />,
        // roles: ['admin'],
      },
      {
        name: "用户登录日志",
        path: '/users/loginLogs',
        component: 'pages/Users/loginLogs',
        icon:<MailOutlined />,
        // roles: ['admin'],
      },
    ]
  },
  {
    name: "车辆管理",
    path: '/vehicleManagement',
    component: 'pages/ZlVehicle/ZlVehicleView',
    icon:<CarOutlined />,
    routes: [
      {
        name: "保险管理",
        path: '/zlvehicle/insuranceManage',
        component: 'pages/ZlVehicle/InsuranceManage/InsuranceManageView',
        icon:<SafetyOutlined />
      },
      {
        name: "维修管理",
        path: '/zlvehicle/maintainManage',
        component: 'pages/ZlVehicle/MaintainManage/MaintainManageView',
        icon:<ToolOutlined />
      },
      {
        name: "保养管理",
        path: '/zlvehicle/keepManage',
        component: 'pages/ZlVehicle/KeepManage/KeepManageView',
        icon:<CarOutlined />
      },
      {
        name: "加油管理",
        path: '/zlvehicle/fuelManage',
        component: 'pages/ZlVehicle/FuelManage/FuelManageView',
        icon:<DatabaseOutlined />
      },
      {
        name: "网约车管理",
        path: '/zlvehicle/onlineCarManage',
        component: 'pages/ZlVehicle/OnlineCarManage/OnlineCarManageView',
        icon:<CarOutlined />

      },
      {
        name: "司机端管理",
        path: '/zlvehicle/driverManage',
        component: 'pages/ZlVehicle/DriverManage/DriverManageView',
        icon:<MobileOutlined />
      },
      {
        name: "APP端管理",
        path: '/zlvehicle/appManage',
        component: 'pages/ZlVehicle/AppManage/AppManageView',
        icon:<ShoppingOutlined />
      },
    ]
  },
  {
    name: "图表管理",
    path: '/ChartLibrary',
    component: 'pages/ChartLibrary',
    icon:<CarOutlined />,
    routes: [
      {
        name: "ChartViwe",
        path: '/ChartLibrary/ChartViwe',
        component: 'pages/ChartLibrary/Chart/index',
        icon:<SafetyOutlined />
      },
      {
        name: "Nivo",
        path: '/ChartLibrary/Nivo',
        component: 'pages/ChartLibrary/Nivo/index',
        icon:<SafetyOutlined />
      },
      {
        name: "Recharts",
        path: '/ChartLibrary/Recharts',
        component: 'pages/ChartLibrary/Recharts/index',
        icon:<SafetyOutlined />
      },
      {
        name: "Victory",
        path: '/ChartLibrary/Victory',
        component: 'pages/ChartLibrary/Victory/index',
        icon:<SafetyOutlined />
      },
      {
        name: "VisxLineChart",
        path: '/ChartLibrary/VisxLineChart',
        component: 'pages/ChartLibrary/Visx/index',
        icon:<SafetyOutlined />
      },
      {
        name: "Plotly",
        path: '/ChartLibrary/Plotly',
        component: 'pages/ChartLibrary/Plotly/index',
        icon:<SafetyOutlined />
      },
      {
        name: "echarts",
        path: '/ChartLibrary/echarts',
        component: 'pages/ChartLibrary/Echarts/index',
        icon:<SafetyOutlined />
      },
    ]
  },
  
  {
    name: "商品管理",
    path: '/goods/manage',
    component: 'pages/GoodsManage',
    icon:<CarOutlined />
  },
  {
    name: "数据监控",
    path: '/zlvehicle/monitor',
    component: 'pages/ZlVehicle/Monitor/MonitorView',
    icon:<CarOutlined />
  }
];

// 根据用户角色过滤路由
export const filterRoutesByRole = (routes, role) => {
  return routes.filter(route => {
    // 检查路由是否有角色限制
    if (route.roles && !route.roles.includes(role)) {
      return false;
    }

    // 递归处理子路由
    if (route.routes) {
      route.routes = filterRoutesByRole(route.routes, role);
    }

    return true;
  });
};

export default routes;